Chris Pollett > Old Classses >
CS116a

( Print View )

Student Corner:
  [Grades Sec1]
  [Submit Sec1]
  [Class Sign Up Sec1]
  [
Lecture Notes]
  [Discussion Board]

Course Info:
  [Texts & Links]
  [Topics/Outcomes]
  [Outcomes Matrix]
  [Grading]
  [Class Protocols]
  [HW/Quiz Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Additional Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]  [Quizzes]

Practice Exams:
  [Midterm]  [Final]

                           












HW#5 --- last modified February 07 2019 04:34:34..

Solution set.

Due date: Dec 4

Files to be submitted:
  Hw5.zip

Purpose:To experiment with projective transformations and with textures.

Related Course Outcomes:

The main course outcomes covered by this assignment are:

LO4 -- Use OpenGL clipping and viewport functions in both 2D and 3D.

LO5 -- Write an OpenGL program that makes used of 2D or 3D affine transformations.

LO6 -- Write an OpenGL program that makes use of lighting and different kinds of materials.

Specification: For this homework I want you to experiment with projection matrices and materials. Your program should make a row of 11 trees arranged evenly along the x-axis, centered at the origin. The trees rest on the x-z plane which should be light green. As you know, a tree is a cylinder trunk made from a deep brown, wood-like material together with a sphere-like top made from a green, plastic material. In addition, it typically has red apples made of a distinct material of your choice different from these two. Five units above the tree of largest x-value you should place a light source. Your camera should initially be placed along the positive z-axis so that the field of view is exactly all eleven trees. The aspect ratio should be set so that the tops and bottoms of the trees occupy the whole viewable vertical direction of the drawn scene. If `z` is the distance of the nearest tree to the camera, then you should set near so that it is `z/2` from the camera in the same direction and far should be at `3z/2`. Your program should have three modes. If you hit the letter `a` you enter aspect mode. Hitting the minus and plus keys will then increase or decrease the aspect ratio. If you hit the letter `f`, then hitting the minus and plus keys will increase or decrease the field of view. Hitting the `z` key will z-axis mode. Hitting the minus and plus keys will then move the user forward or backward along the z-axis, the distance to near and far with respect to the camera should remain constant. Appropriate clipping should occur if one gets to far from or near to the trees. In addition to the above, in front of your forest lurks a scary monster known as the Gratuitous Triangle. It is an equilateral triangle a quarter as tall as a tree placed visible somewhere on the ground so that its front face is facing the camera. Hitting the letter `b` causes it to turn 180 degrees about the y-axis so that its back faces the camera, and so that it should be culled if we enable culling. Repeatedly hitting `b` toggles this 180 degree rotation.

Point Breakdown

Departmental C++ coding guidelines followed1pt
Initially positions of objects in the scene as described (tree positions, trees as described, triangle, camera, 1/2 pt each)2pts
Wood-like material for tree trunks (1/2pt), Plastic material for tops of trees (1/2pt), some other material for apples (1/2pt), light source (0.5pts)2pt
Aspect ratio `a` mode works as described1pt
Field of view `f` mode works as described1pt
`z`-position mode works as described1pt
Clipping occurs appropriately as one gets to far or close1pt
Gratuitous triangle drawn and hitting b works as described1pt
Total10pts